
	***************
	** Summary stats for paper
	***************

	use "$dir/data/allcountries.dta", clear
	drop if missing(age)
		
	** urban status
		
		sum urban if age>=20 & age<60 [aw=weights_population5yr_survey]
		sum urban if age>=60 [aw=weights_population5yr_survey]
		sum urban if age>=80 [aw=weights_population5yr_survey]
			
	** female
		
		sum female if age>=20 & age<60 [aw=weights_population5yr_survey]
		sum female if age>=60 [aw=weights_population5yr_survey]
		sum female if age>=80 [aw=weights_population5yr_survey]
		
		tab country if age<60 [aw=weights_population5yr_survey], sum(female)
		tab country if age>=60 [aw=weights_population5yr_survey], sum(female)
			
	** difficulty seeing or hearing
		
		qui egen diff_see_or_hear=rowmax(diff_seei diff_hear)
			
		qui sum diff_see_or_hear if age>=60 [aw=weights_population5yr_survey]	
			local displaymean=round(`r(mean)',0.01)
			di "** difficulty seeing or hearing (survey + 5 year pop weighting): `displaymean'"
		
		tab country if age>=60 [aw=weights_survey], sum(diff_see_or_hear)
		tab country if age>=60 [aw=weights_population5yr_survey], sum(diff_see_or_hear)
		
	** difficulty walking or climbing stairs
			
		qui sum diff_walk_clim if age>=60 [aw=weights_population5yr_survey]
			local displaymean=round(`r(mean)',0.01)
			di "** difficulty walking or climbing (survey + 5 year pop weighting): `displaymean'"
			
		tab country if age>=60 [aw=weights_survey], sum(diff_walk_clim)
		tab country if age>=60 [aw=weights_population5yr_survey], sum(diff_walk_clim)
		
	** any disability

		qui sum disability if age>=60 [aw=weights_population5yr_survey]
			local displaymean=round(`r(mean)',0.01)
			di "** any disability (survey + 5 year pop weighting): `displaymean'"

		tab country if age>=60 [aw=weights_survey], sum(disability)
		tab country if age>=60 [aw=weights_population5yr_survey], sum(disability)
		
	** illness and injury

		sum ill_inj if age>=60 [aw=weights_population5yr_survey]
			local displaymean=round(`r(mean)',0.01)
			di "** any illness or injury (survey + 5 year pop weighting): `displaymean'"
			
		sum ill_inj_stopactivity if age>=60 & !missing(ill_inj) [aw=weights_population5yr_survey]
			local displaymean=round(`r(mean)',0.01)
			di "** stop activity due to illness or injury (survey + 5 year pop weighting): `displaymean'"
			
		sum ill_inj_stopactivity [aw=weights_population5yr_survey] if ill_inj==1
			local displaymean=round(`r(mean)',0.01)
			di "** stop activity conditional on illness or injury (survey weighting): `displaymean'"
		
	** depression

		sum depressed [aw=weights_survey] if age_group10>=20 & age_group10<60 & country=="gha"
		sum depressed [aw=weights_survey] if age_group10<60 & country=="gha"
		sum depressed [aw=weights_survey] if age_group10>=60 & country=="gha"
		sum depressed [aw=weights_survey] if age_group10>=70 & country=="gha"
		sum depressed [aw=weights_survey] if age_group10>=80 & country=="gha"
		
		sum depressed [aw=weights_survey] if age_group10>=20 & age_group10<60 & country=="saf"	
		sum depressed [aw=weights_survey] if age_group10<60 & country=="saf"
		sum depressed [aw=weights_survey] if age_group10>=60 & country=="saf"
		sum depressed [aw=weights_survey] if age_group10>=70 & country=="saf"
		sum depressed [aw=weights_survey] if age_group10>=80 & country=="saf"	
		
		sum depressed [aw=weights_population5yr_survey] if age_group10>=20 & age_group10<60 & country=="gha"
		sum depressed [aw=weights_population5yr_survey] if age_group10<60 & country=="gha"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=60 & country=="gha"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=70 & country=="gha"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=80 & country=="gha"
		
		sum depressed [aw=weights_population5yr_survey] if age_group10>=20 & age_group10<60 & country=="saf"	
		sum depressed [aw=weights_population5yr_survey] if age_group10<60 & country=="saf"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=60 & country=="saf"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=70 & country=="saf"
		sum depressed [aw=weights_population5yr_survey] if age_group10>=80 & country=="saf"

	** employment

		sum work_any if age>=60 [aw=weights_population5yr_survey]
		sum work_hrs if age>=60 [aw=weights_population5yr_survey]
		
		sum work_any if age>=75 [aw=weights_population5yr_survey]
		sum work_hrs if age>=75 [aw=weights_population5yr_survey]
		
		sum work_any if age>=20 & female==1 [aw=weights_population5yr_survey]
		sum work_hrs if age>=20 & female==1 [aw=weights_population5yr_survey]
		
		sum work_any if age>=20 & female==0 [aw=weights_population5yr_survey]
		sum work_hrs if age>=20 & female==0 [aw=weights_population5yr_survey]
		
		sum work_any if age>=60 & female==1 [aw=weights_population5yr_survey]
		sum work_hrs if age>=60 & female==1 [aw=weights_population5yr_survey]
		
		sum work_any if age>=60 & female==0 [aw=weights_population5yr_survey]
		sum work_hrs if age>=60 & female==0 [aw=weights_population5yr_survey]
		
		** south africa vs not
		
			sum work_any [aw=weights_population5yr_survey] if age_group10>=20 & age_group10<60 & country=="saf"	
			sum work_any [aw=weights_population5yr_survey] if age_group10>=60 & country=="saf"
			sum work_any [aw=weights_population5yr_survey] if age_group10>=60 & country!="saf"
			sum work_any [aw=weights_population5yr_survey] if age_group10>=60
		
	** living alone
		
		sum notmarried if age>=30 & age<60 [aw=weights_population5yr_survey]
		sum notmarried if age>=60 [aw=weights_population5yr_survey]
		sum notmarried if age<60 & female==1 [aw=weights_population5yr_survey]
		sum notmarried if age>=60 & female==1 [aw=weights_population5yr_survey]
		sum notmarried if age>=70 & female==1 [aw=weights_population5yr_survey]
		sum notmarried if age>=80 & female==1 [aw=weights_population5yr_survey]
		sum notmarried if age>=60 & female==0 [aw=weights_population5yr_survey]
		
		sum lives_alone if age>=60 & female==1 [aw=weights_population5yr_survey]
		sum lives_alone if age>=60 & female==0 [aw=weights_population5yr_survey]
		
		sum lives_alone if age>=80 & female==1 [aw=weights_population5yr_survey]
		sum lives_alone if age>=80 & female==0 [aw=weights_population5yr_survey]
		